package com.ruoyi.app.controller;

import com.ruoyi.activeuser.domain.ActiveUser;
import com.ruoyi.activeuser.service.IActiveUserService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 活动参与人Controller
 * 
 * @author hct
 * @date 2022-02-16
 */
@RestController
@RequestMapping("/app/activeuser")
public class AppActiveUserController extends BaseController
{
    @Autowired
    private IActiveUserService activeUserService;

    /**
     * 查询活动参与人列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ActiveUser activeUser)
    {
        startPage();
        List<ActiveUser> list = activeUserService.selectActiveUserList(activeUser);
        return getDataTable(list);
    }


    /**
     * 获取活动参与人详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(activeUserService.selectActiveUserById(id));
    }

    /**
     * 新增活动参与人
     */
    @PostMapping
    public AjaxResult add(@RequestBody ActiveUser activeUser)
    {
        return toAjax(activeUserService.insertActiveUser(activeUser));
    }



    /**
     * 删除活动参与人
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(activeUserService.deleteActiveUserByIds(ids));
    }
}
